<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>分页</title>

    <style>
        * {
            box-sizing: border-box;
        }

        body {
            font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
            font-size: 14px;
            color: #333;
            background-color: #fff;
            margin: 0;
        }

        .paginator {
            margin: 20px 0;
            overflow: hidden;
            border-radius: 4px;
        }

        .paginator>li {
            display: inline;
        }

        .paginator>li>a {
            position: relative;
            float: left;
            padding: 6px 12px;
            margin-left: -1px;
            line-height: 1.4;
            text-decoration: none;
            color: #428bca;
            background-color: #fff;
            border: 1px solid #ddd;
        }

        .paginator>.active>a {
            color: #fff;
            background-color: #428bca;
            border-color: #428bca;
            cursor: default;
        }
    </style>
</head>

<body>
    <ul class="paginator" id="pagination1"></ul>
    <div id="pagination2"></div>

    <script src="https://g.517cdn.com/jQ/jquery-1.9.0.min.js"></script>
    <script src="./src/paginator.js"></script>
    <script>
        $('#pagination1').paginator({
            totalNum: 1000,
            showPage: 9,
            pageSize: 10,
            currentPage: 3,
            prev: '<li class="paginator__prev"><a href="javascript:;">上一页</a></li>',
            next: '<li class="paginator__next"><a href="javascript:;">下一页</a></li>',
            page: '<li class="paginator__page"><a href="javascript:;">{{page}}</a></li>',
            onPageChange: function (num) {
                console.log(num)
            }
        })

        $('#pagination2').paginator({
            wrapper: '<ul class="paginator" ></ul>',
            totalNum: 1000,
            showPage: 9,
            pageSize: 10,
            currentPage: 3,
            prev: '<li class="paginator__prev"><a href="javascript:;">上一页</a></li>',
            next: '<li class="paginator__next"><a href="javascript:;">下一页</a></li>',
            page: '<li class="paginator__page"><a href="javascript:;">{{page}}</a></li>',
            last: '',
            first: '',
            onPageChange: function (num) {
                console.log(num)
            }
        })
    </script>

</body>

</html>